<?php
namespace app\index\controller;
class Family extends Base
{
  public function index(){
    $cate = db('cate')->where('pid',4)->where('catename','neq','企业服务')->select();
    foreach($cate as $k => $v){
      $family = db('cate as a')->join('ht_article b','a.id = b.cateid','left')->field("a.catename,a.der,b.*")->where('pid',$v['id'])->where('pic','neq','')->order('der','asc')->select();
      if($family){
        $cate[$k]['family'] = $family;
      }else{
        $cate[$k]['family'] = array();
      }
    }
    array_multisort(array_column($cate,'der'),SORT_DESC,$cate);
    $this->assign('cate',$cate);
    return view();
  }
  
}
?>